#ifndef VIEWPORT_H_
#define VIEWPORT_H_

#include "map/controllers/CarController.h"
#include "map/MapPoint.h"
#include "gui/objects/GUIMap.h"
#include "gui/objects/GUIRoute.h"
#include "gui/objects/GUIObject.h"
#include "gui/GUIEngine.h"
#include "gui/layers/Layer.h"
#include "util/LinkedList.h"

namespace gui {

/*
 * Enumerado para definir el tipo de movimiento que se quiere de la pantalla.
 */
enum ViewportMove {
	Ini, MoveUp, MoveDown, MoveLeft, MoveRight, None
};

/*
 * Clase que representa la ventana en la que se ve lo que la aplicacion grafica muestra.
 */
class Viewport {
public:

	/* Constructor */
	Viewport(CarController* carController, Layer* background, Layer* foreground, int viewportW, int viewportH, double xScale, double yScale);

	/* Destructor */
	virtual ~Viewport();

	virtual Surface* getPlainSurface();
	virtual void addMiddleLayer(Layer* layer) { this->middleLayers.add(0, layer); }
	virtual void update(MapPoint newPortionPosition);

protected:
	Layer* background;
	util::LinkedList<Layer> middleLayers;
	Layer* foreground;
	Portion portionToDraw;
	Portion screenPortion;

	void applyScale(Surface* surface);
};

}

#endif /* VIEWPORT_H_ */
